package test;

import com.alibaba.fastjson.JSON;
import model.User;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import service.UserService;

import javax.annotation.Resource;

/**
 * Created by lslnx on 2017/4/12.
 */

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring-mybatis.xml"})
public class testMybaits {

    private static Logger logger = Logger.getLogger(testMybaits.class);

    @Resource
    private UserService userService;

    @Test
    public void test1(){
        User u  = userService.selectById(1);
        System.out.println("name:"+u.getUserName());
        logger.info(JSON.toJSONString(u));
    }
}
